-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated code to remove dependency on IS_LOADING_POLICY_DATA for Welcome.js #11627
Updated code to remove dependency on IS_LOADING_POLICY_DATA for Welcome.js #11627
Conversation
b1a0ee9
to
fc1669c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are intentionally removing the IS_LOADING_POLICY_DATA
key. Instead of adding it back, I'd suggest that we remove the Welcome event's dependency on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the only other spots we use that Onyx key is here
App/src/libs/actions/Policy.js
Lines 183 to 203 in ec7d84b
function getPolicyList() { | |
Onyx.set(ONYXKEYS.IS_LOADING_POLICY_DATA, true); | |
DeprecatedAPI.GetPolicySummaryList() | |
.then((data) => { | |
if (data.jsonCode !== 200) { | |
Onyx.set(ONYXKEYS.IS_LOADING_POLICY_DATA, false); | |
return; | |
} | |
const policyCollection = _.reduce(data.policySummaryList, (memo, policy) => ({ | |
...memo, | |
[`${ONYXKEYS.COLLECTION.POLICY}${policy.id}`]: getSimplifiedPolicyObject(policy, false), | |
}), {}); | |
if (!_.isEmpty(policyCollection)) { | |
updateAllPolicies(policyCollection); | |
} | |
Onyx.set(ONYXKEYS.IS_LOADING_POLICY_DATA, false); | |
}); | |
} |
src/libs/actions/App.js
Outdated
}, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strange I thought we'd prefer what was there before (}]
) did the linter complain about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 I think the other way reads better. Same for the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with Bondy's comments. Let's revert the style changes in actions/App
and remove this code and this Onyx key
src/libs/actions/App.js
Outdated
}, | ||
], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 I think the other way reads better. Same for the others.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 nice work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! While reviewing this, I noticed that we might have another bug (not introduced in this PR)
This code is supposed to load all policies, but it actually loads all reports. So the first part of this conditional will probably always be true and admins of workspaces would also see the welcome action.
We can fix that in this PR too!
Great catch, since policy data are not loaded this makes sense. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@techievivek I had to merge main to be able to see the policy expense chats. The solution seem to work well on web, desktop and mWeb Chrome, but it did not work on android, iOS or mWeb safari.
I see that you had videos with the solution working, so I'm wondering if it's just me holding something wrong. @bondydaa could you try to test this solution in iOS/android?
web.mov
desktop.mov
chrome.mov
android.mov
ios.mov
safari.mov
That's odd, let me try testing it once again and probably adding some log statements to make sure logic is being hit. |
In the logs, I could see that we were trying to navigate to the correct expense chat report. It might just be some RN navigation quirk. |
I struggled with the DEV environment setup yesterday, so couldn't look into it. I will test it today. |
I tested this locally and experienced the same thing that @luacmartins experienced. I wasn't able to test this further because of the In the logs, it does show that we will be navigation to the workspace chat but it just freezes. |
@techievivek this is some quirk with react-navigation. I'd see if anybody in engineeering-chat has some ideas on how to fix this. I had a similar issue not too long ago |
@techievivek since this is a react navigation issue, I think we should merge this to partially fix the problem and then open another issue to investigate the RN nav issue. Could you please update your branch with main? I'll review it again and merge this PR then. |
Alright, I have merged with main now. |
@techievivek can you update your author checklist? I think that we have a new version and that's why your PR Author checklist check is failing |
@luacmartins I have ticked all the options. I am not sure why it is still failing. |
@luacmartins, thanks for the note, I have updated the checklists. |
web.movdesktop.movchrome.movandroid.movios.movsafari.mov |
@techievivek I created a new issue for the react navigation quirk on iOS and android and assigned it to you. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by @luacmartins in version: 1.2.19-0 🚀
|
🚀 Deployed to production by @chiragsalian in version: 1.2.19-2 🚀
|
Late to the party, but I would have re-named this if we are relaying on a "report data is loading" flag to mean more than just the report data is loading. |
Details
In Welcome.js remove the usage of
IS_LOADING_POLICY_DATA
because report and policy data are loaded together so we can just rely onIS_LOADING_REPORT_DATA
to trust that both report and policy data are available.Fixed Issues
$ https://github.com/Expensify/Expensify/issues/211216
PROPOSAL: GH_LINK_ISSUE(COMMENT)
Tests
>
Invite.The workspace chat would look something like this.
./clitools.sh
on PROD you can click on the email.QA Steps
>
Invite.The workspace chat would look something like this.
PR Review Checklist
PR Author Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The reviewer will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
this
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Screenshots
Web
Screen.Recording.2022-10-06.at.3.14.57.PM.mov
Mobile Web - Chrome
Screen.Recording.2022-10-10.at.2.47.55.PM.mov
Mobile Web - Safari
ios-safari.mov
Desktop
desktop.mov
iOS
ios.mov
Android
android.mov